unit Cataurus.nwn.utils;

interface

uses
  SysUtils;

function GetNWN1Directory : string;
function DateiIsErf(DateiName : TFileName) : Boolean;

implementation

uses
  Registry, Windows;

function GetNWN1Directory : string;
var
  MyRegistry : TRegistry;
begin
  result := '';
  MyRegistry := TRegistry.Create;
  try
    MyRegistry.RootKey := HKEY_LOCAL_MACHINE;
    MyRegistry.OpenKey('SOFTWARE\BioWare\NWN\Neverwinter', false);
    result := MyRegistry.ReadString('Path');
  finally
    MyRegistry.Free;
  end;
end;

function DateiIsErf(DateiName : TFileName) : Boolean;
var
  sExt: string;
begin
  result := false;
  sExt := ExtractFileExt(DateiName);
  if LowerCase(sExt) = '.erf' then
  begin
    result := true;
  end else
    if LowerCase(sExt) = '.mod' then
    begin
      result := true;
    end else
      if LowerCase(sExt) = '.hak' then
      begin
        result := true;
      end;

end;

end.
